﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace FederatedSearchSL
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void btnGenerateSimple_Click(object sender, RoutedEventArgs e)
        {
            string url = string.Format("GetOpenSearchDef.aspx?action=bing&sn={0}&url={1}",
                HttpUtility.HtmlEncode(tbName.Text), HttpUtility.HtmlEncode(tbSimpleUrl.Text));
            HtmlPage.Window.Navigate(new Uri(url, UriKind.Relative));
        }

        private void btnGenerateFull_Click(object sender, RoutedEventArgs e)
        {
            string url = string.Format("GetOpenSearchDef.aspx?action=osdx&sn={0}&rss={1}&atom={2}&d={3}",
                HttpUtility.HtmlEncode(tbTitle.Text), HttpUtility.HtmlEncode(tbRss.Text), HttpUtility.HtmlEncode(tbAtom.Text), HttpUtility.HtmlEncode(tbDescription.Text));
            HtmlPage.Window.Navigate(new Uri(url, UriKind.Relative));
        }
    }
}
